package com.pic.mgt.monitor.physicalmonitor;

import java.io.File;
import java.io.FilenameFilter;

public class FilenameSuffixFilter implements FilenameFilter {
	private String acceptSuffixs[] = null;
	
	@Override
	public boolean accept(File arg0, String arg1) {
		if (this.acceptSuffixs == null) {
			return true;
		}
		
		boolean acceptable = false;
		
		for (String suffix : acceptSuffixs) {
			if (arg1.endsWith(suffix)) {
				acceptable = true;
				break;
			}
		}
		
		return acceptable; 
	}

	public void setAcceptSuffixs(String ... acceptSuffixs) {
		this.acceptSuffixs = acceptSuffixs;
	}

}
